#include <iostream>
#include "broadcast_acceptor.hpp"

void onData(const std::vector<uint8_t>& data, const std::string& ip, uint16_t port)
{
    std::cout << "Received broadcast data from: " << ip << ":" << port 
              << ", byte count: " << data.size() << std::endl;
}

int main()
{
    BroadcastAcceptor acceptor{onData};

    if (acceptor.init(5555, "0.0.0.0") == false)
    {
        std::cout << "Failed to start broadcast acceptor." << std::endl;
        return -1;
    }
    std::cout << "Broadcast acceptor started. " << std::endl;
    acceptor.run();
    acceptor.release();
    return 0;
}